library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;


entity sram_emu IS
    PORT( 
       sram_addr          : in   std_logic_vector(17 DOWNTO 0);
       sram_data          : inout std_logic_vector(15 DOWNTO 0);
       sram_wren          : in   std_logic 
    );
end sram_emu;



architecture Behavioral of sram_emu is
   
  type tsram is array (0 to 262143) of std_logic_vector(15 downto 0);  
  signal sram : tsram;
    
begin
        

 
process (sram_data)
begin
    
    if sram_wren='0' then
      sram(to_integer(unsigned(sram_addr))) <= sram_data;
    end if;  
    
end process;

  sram_data <= (others => 'Z') when sram_wren='0' else sram(to_integer(unsigned(sram_addr)));

end Behavioral;



